<template>
  <a-card :bordered="false">

    <!-- 操作按钮区域 -->
    <div class="table-operator" :md="24" :sm="24" style="margin: -25px 0px 10px 0px">

    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
        selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
          <!--<a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical"/>-->
          <a-dropdown>
            <a class="ant-dropdown-link">
              更多 <a-icon type="down"/>
            </a>
            <!--<a-menu slot="overlay">
              <a-menu-item>
                <a href="javascript:;" @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>-->
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <detailDebtCustomer-modal ref="modalForm" @ok="modalFormOk"></detailDebtCustomer-modal>
  </a-card>
</template>

<script>
  import DetailDebtCustomerModal from './modules/DetailDebtCustomerModal'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import MainDebtCustomerList from './MainDebtCustomerList'
  import { getAction } from '@/api/manage'

  export default {
    name: 'DetailDebtCustomerList',
    mixins: [JeecgListMixin],
    components: {
      MainDebtCustomerList,
      DetailDebtCustomerModal
    },
    data() {
      return {
        isorter:{
        },
        description: '客户未付款明细',
        // 表头
        columns: [
          {
            title: '客户ID',
            align: 'center',
            dataIndex: 'customId'
            , width: 100
          },
          {
            title: '客户名称',
            align: 'center',
            dataIndex: 'customName'
            , width: 300
          },
          {
            title: '业务日期',
            align: 'center',
            dataIndex: 'createDate'
            , width: 150
          },
          {
            title: '发货日期',
            align: 'center',
            dataIndex: 'ywCreateDate'
            , width: 150
          },
          {
            title: '年份',
            align: 'center',
            dataIndex: 'year'
            , width: 100
          },
          {
            title: '月份',
            align: 'center',
            dataIndex: 'month'
            , width: 100
          },
          {
            title: '金额',
            align: 'center',
            dataIndex: 'totalLine'
            , width: 100
          },
          {
            title: '业务单据',
            align: 'center',
            dataIndex: 'docType'
            , width: 150
          },
          {
            title: '客户性质',
            align: 'center',
            dataIndex: 'customerType'
            , width: 120
          },
          {
            title: '结算方式',
            align: 'center',
            dataIndex: 'settleType'
            , width: 120
          },
          {
            title: '业务员ID',
            align: 'center',
            dataIndex: 'salesmanId'
            , width: 100
          },
          {
            title: '业务员名称',
            align: 'center',
            dataIndex: 'salesman'
            , width: 120
          },
          {
            title: '区域开票员',
            align: 'center',
            dataIndex: 'zxKpman'
            , width: 120
          },
          {
            title: '区域',
            align: 'center',
            dataIndex: 'zxArea'
            , width: 80
          },
          {
            title: '运输线路',
            align: 'center',
            dataIndex: 'tranPosName'
            , width: 80
          },
          {
            title: '会计员',
            align: 'center',
            dataIndex: 'zxAccount'
            , width: 80
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            scopedSlots: { customRender: 'action' },
            width: 80
          }
        ],
        url: {
          list: '/inca/debtCustomer/getListByMainId'
        },
      }
    },
    methods: {
      loadData(arg) {
        if (arg === 1) {
          this.ipagination.current = 1
        }
        //update-begin--Author:kangxiaolin  Date:20190905 for：[442]主子表分开维护，生成的代码子表的分页改为真实的分页--------------------
        var params = this.getQueryParams();
        //debugger;
        getAction(this.url.list, {
          customId: params.customId, pageNo: this.ipagination.current,
          pageSize: this.ipagination.pageSize
        }).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records
            this.ipagination.total = res.result.total
          } else {
            this.dataSource = null
          }
        })
        //update-end--Author:kangxiaolin  Date:20190905 for：[442]主子表分开维护，生成的代码子表的分页改为真实的分页--------------------
      },
      getCustomerDebtMain(customId) {
        this.queryParam.customId = customId
        this.loadData(1)
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>